package com.fr.base.core.antlr.collections.impl;

import java.util.Enumeration;
import java.util.Hashtable;

public class IndexedVector
{
  protected Vector elements;
  protected Hashtable index;

  public IndexedVector()
  {
    this.elements = new Vector(10);
    this.index = new Hashtable(10);
  }

  public IndexedVector(int paramInt)
  {
    this.elements = new Vector(paramInt);
    this.index = new Hashtable(paramInt);
  }

  public synchronized void appendElement(Object paramObject1, Object paramObject2)
  {
    this.elements.appendElement(paramObject2);
    this.index.put(paramObject1, paramObject2);
  }

  public Object elementAt(int paramInt)
  {
    return this.elements.elementAt(paramInt);
  }

  public Enumeration elements()
  {
    return this.elements.elements();
  }

  public Object getElement(Object paramObject)
  {
    Object localObject = this.index.get(paramObject);
    return localObject;
  }

  public synchronized boolean removeElement(Object paramObject)
  {
    Object localObject = this.index.get(paramObject);
    if (localObject == null)
      return false;
    this.index.remove(paramObject);
    this.elements.removeElement(localObject);
    return false;
  }

  public int size()
  {
    return this.elements.size();
  }
}